]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
lightbox: Fix shader effect
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 24 Feb 2021 01:28:09 +0000 (02:28 +0100)
committerMarge Bot <marge-bot@gnome.org>
Wed, 24 Feb 2021 09:52:45 +0000 (09:52 +0000)
Since commit 0f1b566918e, we use gjs' automatic getters/setters for
the shader properties. Those handle the properties on the JS and
GObject side, but they don't update the corresponding uniform,
whoops.

Revert the lightbox bits of commit 0f1b566918 to get the effect back.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1712>

js/ui/lightbox.js

index d8de7e73049500c10fc9931ad48902aa006690eb..8348abada0a12020b061a93b0379f6404de6ec85 100644 (file)
@@ -35,13 +35,16 @@ var RadialShaderEffect = GObject.registerClass({
     },
 }, class RadialShaderEffect extends Shell.GLSLEffect {
     _init(params) {
+        this._brightness = undefined;
+        this._sharpness = undefined;
+
         super._init(params);
 
         this._brightnessLocation = this.get_uniform_location('brightness');
         this._sharpnessLocation = this.get_uniform_location('vignette_sharpness');
 
-        this._setBrightnessUniform();
-        this._setSharpnessUniform();
+        this.brightness = 1.0;
+        this.sharpness = 0.0;
     }
 
     vfunc_build_pipeline() {
@@ -49,14 +52,30 @@ var RadialShaderEffect = GObject.registerClass({
                               VIGNETTE_DECLARATIONS, VIGNETTE_CODE, true);
     }
 
-    _setBrightnessUniform() {
+    get brightness() {
+        return this._brightness;
+    }
+
+    set brightness(v) {
+        if (this._brightness === v)
+            return;
+        this._brightness = v;
         this.set_uniform_float(this._brightnessLocation,
-            1, [this.brightness]);
+            1, [this._brightness]);
+        this.notify('brightness');
     }
 
-    _setSharpnessUniform() {
+    get sharpness() {
+        return this._sharpness;
+    }
+
+    set sharpness(v) {
+        if (this._sharpness === v)
+            return;
+        this._sharpness = v;
         this.set_uniform_float(this._sharpnessLocation,
-            1, [this.sharpness]);
+            1, [this._sharpness]);
+        this.notify('sharpness');
     }
 });